<?php
/**
 * container for email address + name
 * @package simplemail
 * @version 1.3
 * @author Tetsuo
 * @contributor j.ducastel
 */
class SimpleMailAddress {
    function SimpleMailAddress($email,$name='') {
        $this->email=$email;
        $this->name=$name;
    }

    function isValid() {
        return ereg('^[._0-9a-zA-Z-]+@[.0-9a-zA-Z-]+\.[0-9a-zA-Z]{2,4}$',$this->email);
    }

    function __toString() {
        if ($this->name!=$this->email)
            return $this->name.' <'.$this->email.'>';
        return $this->email;
    }

    var $email;

    var $name;
}